class Parent {
    constructor(name) {
      // this.name = name;
      this.name = 'father-name'; // 父类的属性会被子类声明的相同属性所覆盖
    //   console.log(this.name);
    }
    parentFunction() {
      console.log("This is a parent function.");
    }
  }
  
  class Child extends Parent {
    constructor(name, age) {
      super(name);
      this.name = name;//覆盖父类的name属性
      this.age = age;
    }
    childFunction() {
      // super.parentFunction(); // 调用父类的普通函数
      console.log("This is a child function.");
    }
  }
  
  // const child = new Child(10);
  const child = new Child('child-name',10);
  console.log(child.name); // 输出: child-name
  console.log(child.age); // 输出: 10

  // child.childFunction()